/*
* testApp.h
*
* Created by Joey van der Bie and Vincent Vijn
* www.vanderBie.net & Vincent.Vijn.me
* With code from Theo Watson, Jesus Gollonet and Diego Diaz
*
* 15-04-2010
* Media Technology - University Leiden
*/

#ifndef _TEST_APP
#define _TEST_APP


#include "ofMain.h"
#include "ofxCvMain.h"

#include "cv.h"
#include "headmanager.h"
/*
in this case we're storing the slitted image in a second buffer and then slicing
it horizontally
*/


class testApp : public ofSimpleApp{

	public:

		void setup();
		void update();
		void draw();

		void keyPressed  (int key);
		void mouseMoved(int x, int y );
		void mouseDragged(int x, int y, int button);
		void mousePressed(int x, int y, int button);
		void mouseReleased();

	private:

		ofVideoGrabber 	vid;
		ofVideoPlayer vplay;
		unsigned char **    videoData;
		unsigned char **    slitData;

		int                 nFramesToRecord;
        int                 maxFramesToRecord;
        int                 nRecorded;

		int horizPw, horizPh;
		unsigned char * horizP;
		ofTexture		horizPtex;

		ofTexture delayed;
		ofTexture * videoTextures;


		unsigned char * slitPx;
		ofTexture		slitTex;

		unsigned char * mixedP;
		ofTexture		mixedPtex;


		bool			reverse;

        // array of portions;
        struct Portion **   strPortions;
        int                 maxPortions;

        ofxCvColorImage		colorImg;

		headmanager			hm;
		ofxCvColorImage		frame_copy;


        int imgW, imgH, imgColors;
        int pW, pH, pMod;
        int zoom;

        int nPortions;

        ofTrueTypeFont      verdana;

        int                 direction;
        int                 directionLine;
        int                 directionLineVert;
        int                 prevDirectionLine;
        int                 prevDirectionLineVert;

		// Movies
		string movieArray[1];
		int moviePos;
};


#endif
